<!doctype html>
<html>
 <head> 
  <meta charset="utf-8"> 
  <title>sliderVerify 滑块验证组件 sliderVerify - layui 第三方组件平台</title> 
  <meta name="renderer" content="webkit"> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
  <meta name="description" content="滑块解锁验证 ，此插件仅提供学习交流"> 
  <link rel="stylesheet" href="/t/font_24081_60slu02pimt.css">
  <link rel="stylesheet" href="/layui/dist/css/layui.css">
  <link rel="stylesheet" href="/static/css/fly/global.css" charset="utf-8">
  <link rel="stylesheet" href="/static/css/global.css" charset="utf-8">
  <link rel="stylesheet" href="/static/css/global.css" charset="utf-8">
 </head>
 <body>
  <div class="layui-header header header-extends" style="background-color: #24262F;"> 
   <div class="layui-container"> <a class="logo" href="https://layui.itmtr.cn/"> <img src="/static/images/layui/logo.png" alt="layui"> </a> 
    <div class="layui-form component" lay-filter="LAY-site-header-component"></div> 
    <ul class="layui-nav"> 
     <li class="layui-nav-item layui-hide-xs"> <a href="//layui.itmtr.cn/">框架</a> </li> 
     <li class="layui-nav-item layui-hide-xs layui-this"> <a href="/extend/index.html">扩展</a> </li> 
     <li class="layui-nav-item"> <a href="javascript:;">周边</a> 
      <dl class="layui-nav-child layui-nav-child-c"> 
       <dd lay-unselect> <a href="//layui.itmtr.cn/alone.html" target="_blank">独立组件</a> 
       </dd> 
       <dd class="layui-hide-sm layui-show-xs" lay-unselect> <a href="/extend/index.html">扩展组件</a> 
        <hr> 
       </dd> 
      </dl> </li> 
    </ul> 
   </div>
  </div><!--[if lt IE 9]>  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script><![endif]--> 
  <div class="fly-extend-banner fly-extend-banner-sm"> 
   <div class="layui-carousel" id="FLY-extend-banner" data-height="200px"> 
    <div carousel-item> 
     <div style="background-image: url(/upload/2018_8/168_1535373858670_8825.jpg)">
      <div style="background: rgba(0,0,0,.6)"></div> 
     </div> 
    </div> 
   </div> 
   <h1 class="fly-extend-banner-title">layui 第三方组件平台</h1> 
   <div class="fly-extend-banner-release"> <a href="/extend/index.html" class="layui-btn layui-btn-lg">返回首页</a>
   </div> 
  </div>
  <div class="fly-extend-detail layui-card"> 
   <div class="layui-container"> 
    <div class="fly-extend-list-header"> 
     <h1 class="fly-extend-title layui-elip"> <a>sliderVerify 滑块验证组件</a> <span class="layui-badge layui-bg-green layui-hide-xs">sliderVerify</span> </h1> 
     <div class="fly-extend-list-info"> <a href="/u/8436456/index.html" target="_blank" class="fly-extend-list-user" title="发布者"> <cite class="layui-hide-xs">go**a</cite> <img src="/avatar/8436456.png" alt="go**a"> </a> 
     </div> 
    </div> 
    <blockquote class="fly-extend-list-desc layui-elem-quote"> 
     <p>滑块解锁验证 ，此插件仅提供学习交流</p> 
    </blockquote> 
    <div class="fly-extend-list-bottom"> <span class="layui-inline">更新：2021-5-2 </span> <span class="layui-inline">创建：2019-2-17 </span> 
     <div class="layui-btn-container layui-extend-doc-edit"> 
     </div> 
    </div> 
   </div>
  </div>
  <div class="layui-container"> 
   <div class="layui-row layui-col-space20"> 
    <div class="layui-col-sm3 layui-col-md2"> 
     <div class="layui-card"> 
      <ul class="fly-extend-doc-nav" lay-filter="extend-doc-nav"> 
       <li class="layui-this" lay-id="doc"> <a href="javascript:;"><i class="iconfont icon-wendang"></i> 文档</a> </li> 
       <li lay-id="download"> <a href="javascript:;"><i class="iconfont icon-xiazai"></i> 下载</a> </li> 
       <li lay-id=""> <a href="https://jishudaquan.gitee.io/slidervalidate/" rel="nofollow" target="_blank"> <i class="iconfont icon-kaifashili"></i> 来源 </a> </li> 
      </ul> 
     </div> 
    </div> 
    <div class="layui-col-sm9 layui-col-md10"> 
     <div class="layui-card fly-extend-doc layui-show"> 
      <div class="layui-card-header"> 
       <h3 class="layui-inline layui-this">文档</h3> 
      </div> 
      <div class="layui-card-body detail-body photos layui-text"> <a href="/jie/47604/" target="_blank">来此讨论</a> <a href="https://jishudaquan.gitee.io/slidervalidate" target="_blank" rel="nofollow">在线预览</a> <a href="https://gitee.com/jishudaquan/sliderValidate/stargazers" target="_blank" rel="nofollow"><img src="/jishudaquan/sliderValidate/badge/star.svg"></a>
       <br>
       <br>
       <div class="layui-elem-quote">
        更新日志：
       </div>2020/3/4 14:00 修拽窗口滑块长度不兼容 兼容ie10
       <br>
       <hr>2020/1/16 17:47 修复部分浏览器滑动时会左右翻页
       <br>
       <hr>2019/5/7 09:52 尝试减弱动画
       <br>
       <hr>2019/4/30 17:31 安卓微信浏览器滑动失效已解决
       <br>
       <hr>2019/2/22 17:45 组件增加重置功能 修复当开启验证 组件验证过程中下滑1px像素
       <br>
       <br>
       <br>
       <div class="layui-elem-quote">
         快速上手： 获得 layui 后，将其完整地部署到你的项目目录（或静态资源服务器），你只需要引入下述一个文件：
       </div>
       <pre>./sliderVerify/sliderVerify.js</pre>
       <div class="layui-elem-quote">
         入门案例：
        <pre>var slider = sliderVerify.render({<br>       elem: '#slider'<br>})</pre>
       </div>
       <pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>	&lt;meta charset="utf-8" /&gt;<br>	&lt;title&gt;&lt;/title&gt;<br>	&lt;meta name="renderer" content="webkit"&gt;<br>	  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;<br>	  &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"&gt;<br>	&lt;link rel="stylesheet" href="layui/css/layui.css" /&gt;<br>	&lt;/head&gt;<br>	&lt;body&gt;<br>		&lt;form class="layui-form" action=""&gt;<br>			&lt;div class="layui-form-item"&gt;<br>				&lt;label class="layui-form-label"&gt;输入框&lt;/label&gt;<br>				&lt;div class="layui-input-block"&gt;<br>					&lt;input type="text" name="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input"&gt;<br>				&lt;/div&gt;<br>			&lt;/div&gt;<br>			&lt;div class="layui-form-item"&gt;<br>				&lt;label class="layui-form-label"&gt;滑动验证&lt;/label&gt;<br>				&lt;div class="layui-input-block"&gt;<br>					&lt;div id="slider"&gt;&lt;/div&gt;<br>				&lt;/div&gt;<br>			&lt;/div&gt;<br>			&lt;div class="layui-form-item"&gt;<br>				&lt;div class="layui-input-block"&gt;<br>					&lt;button class="layui-btn" lay-submit lay-filter="formDemo"&gt;立即提交&lt;/button&gt;<br>					&lt;button type="reset" class="layui-btn layui-btn-primary"&gt;重置&lt;/button&gt;<br>				&lt;/div&gt;<br>			&lt;/div&gt;<br>		&lt;/form&gt;<br>&lt;script src="../layui/layui.js"&gt;&lt;/script&gt;<br>&lt;script&gt;<br>		//一般直接写在一个js文件中<br>		layui.config({<br>			base: 'dist/sliderVerify/'<br>		}).use(['sliderVerify', 'jquery', 'form'], function() {<br>			var sliderVerify = layui.sliderVerify,<br>				form = layui.form;<br>			var slider = sliderVerify.render({<br>				elem: '#slider'<br>			})<br>			//监听提交<br>			form.on('submit(formDemo)', function(data) {<br>				if(slider.isOk()){//用于表单验证是否已经滑动成功<br>					layer.msg(JSON.stringify(data.field));<br>				}else{<br>					layer.msg("请先通过滑块验证");<br>				}<br>				return false;<br>			});<br>			<br>		})<br>&lt;/script&gt; <br>&lt;/body&gt;<br>&lt;/html&gt;</pre>
       <div class="layui-elem-quote">
         如果你想按照自己的风格定义样式你可以这样：
       </div>
       <pre>var slider = sliderVerify.render({<br>	elem: '#slider',<br>	isAutoVerify:false,//关闭自动验证<br>	bg : 'layui-bg-red',//自定义背景样式名<br>	text : '滑动',<br>	onOk: function(){//当验证通过回调<br>		layer.msg("滑块验证通过");<br>	}<br>})</pre>效果
       <img alt="[嘻嘻]" title="[嘻嘻]" src="/t4/appstyle/expression/ext/normal/0b/tootha_thumb.gif"> 
       <br>
       <br>
       <img src="/upload/2019_1/8436456_1547607071882_91431.png"> 
       <img src="/upload/2019_1/8436456_1547607096596_18977.png"> 
       <br>提交表单时 默认配置为true
       <div class="layui-elem-quote">
         isAutoVerify:true,//自动验证
       </div>如果未滑动滑块 那么会自动验证阻止提交
       <br>
       <img src="/upload/2019_1/8436456_1547607254868_34942.png"> 
       <br>另外 如果你不是用的layui的form提交 那么这里提供了一种方法
       <br>
       <hr>
       <pre>slider.isOk() //获取当前实例是否已经滑动成功</pre>可以拿去放在你自己想要验证的form中 作为校验依据
       <br>
       <hr>或者你可以配置一下滑动成功时的回调
       <br>
       <pre>var slider = sliderVerify.render({<br>	elem: '#slider',<br>	onOk: function(){//当验证通过回调<br>		layer.msg("滑块验证通过");<br>	}<br>})</pre>
       <hr>使用该方法可以将组件重置
       <br> 
       <pre>slider.reset();</pre>当然 我这里抛砖引玉 大家按需更改即可
       <img alt="[微笑]" title="[微笑]" src="/t4/appstyle/expression/ext/normal/5c/huanglianwx_thumb.gif"> 可以用于学习交流 欢迎大家提提意见
       <br> 
      </div> 
     </div> 
     <div class="layui-card fly-extend-doc"> 
      <div class="layui-card-header"> 
       <h3 class="layui-inline layui-this">下载</h3> 
      </div> 
      <div class="layui-card-body detail-body layui-text"> 
       <div class="layui-btn-container"> <a href="//cdn.layui.com/extend/8436456_1587483164153_66270.zip" target="_blank" class="layui-btn layui-btn-lg layui-btn-primary"> 立即下载 </a> <a href="https://gitee.com/jishudaquan/sliderValidate" target="_blank" class="layui-btn layui-btn-lg layui-btn-primary layui-border-red"> 去码云下载 </a> <a href="https://github.com/good-ideal/sliderVerify" target="_blank" class="layui-btn layui-btn-lg layui-btn-primary layui-border-black"> 去 GitHub 下载 </a> 
        <blockquote class="layui-elem-quote">
          该扩展组件由第三方用户主动投递，并由其自身进行维护，本站仅做收集。 
        </blockquote> 
       </div> 
      </div> 
     </div> 
    </div> 
   </div>
  </div>
  <div class="fly-footer"> 
   <p>Copyright © 2021 <a href="/index.html">layui.itmtr.cn</a> MIT Licensed</p>
  </div>
  <script src="/layui/dist/layui.js"></script>
  <script>// common</script>

 </body>
<script src="/common/common.js"></script>
</html>